<template>
<view class="container">
	<block v-if="isload">
		<view style="width:100%;height:220rpx"></view>
		<view>
		  <view class="nodata" v-if="val != null && (typeof val !== 'string' || val.trim() !== '')">
			  <view class="nodata-img">
			      <tki-barcode
			      ref="barcode"
			      :show="show"
			      :format="format"
			      :cid="cid"
			      :val="val"
			      :unit="unit"
			      :opations="opations"
			      :onval="onval"
			      :loadMake="loadMake"
			      @result="barresult" />
			  </view>
			  <view class="nodata-text-red">请翻转手机，将该条形码展示给商家</view>
		    <view class="nodata-text">{{ text }}</view>
		  </view>
		</view>
	</block>
	<dp-tabbar :opt="opt" @getmenuindex="getmenuindex"></dp-tabbar>
	<popmsg ref="popmsg"></popmsg>
</view>
</template>

<script>
import tkiBarcode from "@/components/tki-barcode/tki-barcode.vue"
var app = getApp();

export default {
	components: {tkiBarcode},
  data() {
    return {
		opt:{},
		loading:false,
		isload: false,
		menuindex:-1,
		st: 'all',
		nodata:false,
		text: '',
		show: true,
		format: 'code128',
		cid: 'barcode01',
		val: '',
		unit: 'upx',
		opations: {
			width: 4,
			height: 120,
			displayValue: false
		},
		onval: 'false',
		loadMake: true
    };
  },

  onLoad: function (opt) {
		this.opt = app.getopts(opt);
		this.getdata();
  },
  onShow:function(){
		if(app.globalData.platform=='wx' && app.globalData.hide_home_button==1){
			uni.hideHomeButton();
		}
  },
  methods: {
    getdata: function () {
    	var that = this;
    	that.loading = true;
    	app.get('ApiMy/set', {}, function (data) {
    		that.loading = false;
			if (data && data.userinfo && data.userinfo.tel !== undefined) {
			  that.val = data.userinfo.tel;
			  that.text = '手机号：'+ data.userinfo.tel;
			}else{
				app.alert('手机号为空，请设置手机号后再试');
			}
    		that.loaded();
    	});
    }
  }
};
</script>
<style>
.container{ width:100%;}
.nodata {
  width: 100%;
  text-align: center;
  padding-top: 100rpx;
  padding-bottom: 100rpx;
}
.nodata-img {
  /* width: 600rpx;*/
  height: 200rpx;
  display: inline-block;
}
.nodata-text-red {
  display: block;
  text-align: center;
  color: #ff0000;
  font-size: 28rpx;
  width: 100%;
  margin-top: 30rpx;
}
.nodata-text {
  display: block;
  text-align: center;
  color: #999999;
  font-size: 28rpx;
  width: 100%;
  margin-top: 30rpx;
}
</style>